package base

import (
	"gitee.com/leehuajun/youfu-util/ctype"
	"gitee.com/leehuajun/youfu-util/status"
)

// BaseModel 实体基础类型
type BaseModel struct {
	IdModel `xorm:"extends"`
	//Id string `xorm:"not null pk varchar(20) comment('主键')" json:"id"`
	//Version   int        `xorm:"comment('版本') version" json:"version"`
	CreatedAt     ctype.Time `xorm:"comment('创建日期') created index 'created_at'" json:"created_at"`
	CreatedBy     string     `xorm:"comment('创建者') varchar(20) index" json:"created_by"`
	CreatedByName string     `xorm:"comment('创建者名称') varchar(50)" json:"created_by_name"`
	UpdatedAt     ctype.Time `xorm:"comment('修改日期') updated 'updated_at'" json:"updated_at"`
	UpdatedBy     string     `xorm:"comment('修改者') varchar(20) index" json:"updated_by"`
	UpdatedByName string     `xorm:"comment('修改者名称') varchar(50)" json:"updated_by_name"`
	//DeletedAt ctype.Time `xorm:"comment('删除日期') deleted 'deleted_at'" json:"deleted_at"`
	//DeletedBy     int64  `xorm:"comment('删除者') index" json:"deleted_by"`
	//DeletedByName string `xorm:"comment('删除者名称') varchar(50)" json:"deleted_by_name"`
	//Enabled bool `xorm:"comment('是否启用,默认启用')" json:"enabled"`
	//Enabled int8 `xorm:"default(0) comment('是否启用,默认启用')" json:"enabled"`
	Status status.ObjectStatus `xorm:"comment('对象状态')" json:"status"`
}

// BeforeInsert 使用rs/xid，生成唯一id，20位长度
//func (m *BaseModel) BeforeInsert() {
//	m.Id = xid.New().String()
//}
